home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / mayaHardwareGetCommonGlobalV < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.7 KB  |  113 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global proc string mayaHardwareGetCommonGlobalValue(
  18.     string $global)
  19. {
  20.     //
  21.     // Description:
  22.     //    This procedure is called when the current renderer has changed from the
  23.     //    Maya Hardware renderer to something else.
  24.     //    This procedure returns the value of the common global specified by
  25.     //    $global.
  26.     //    For a complete list of valid values for the $global argument, and to
  27.     //    see how this procedure is used, see copyCommonRenderGlobals.mel.
  28.     //
  29.     // Returns: 
  30.     //    The value of the specified common global, as a string. 
  31.     //
  32.  
  33.     string     $value;
  34.  
  35.     switch ($global)
  36.     {
  37.         case "animation":
  38.             $value = `getAttr defaultRenderGlobals.animation`;
  39.             break;
  40.         case "startFrame":
  41.             $value = `getAttr hardwareRenderGlobals.startFrame`;
  42.             break;
  43.         case "endFrame":
  44.             $value = `getAttr hardwareRenderGlobals.endFrame`;
  45.             break;
  46.         case "byFrame":
  47.             $value = `getAttr hardwareRenderGlobals.byFrame`;
  48.             break;
  49.         case "renderableObjects":
  50.             global string $hardwareRenderSelectedFlag;
  51.             if ($hardwareRenderSelectedFlag == "-renderSelected")
  52.             {
  53.                 $value = "selected";
  54.             }
  55.             else
  56.             {
  57.                 $value = "all";
  58.             }
  59.             break;
  60.         case "useCustomExtension":
  61.             $value = `getAttr hardwareRenderGlobals.useCustomExtension`;
  62.             break;
  63.         case "customExtension":
  64.             $value = `getAttr hardwareRenderGlobals.customExtension`;
  65.             break;
  66.         case "renumberFrameUsing":
  67.             $value = `getAttr hardwareRenderGlobals.modifyExtension`;
  68.             break;
  69.         case "renumberStartFrame":
  70.             $value = `getAttr hardwareRenderGlobals.startExtension`;
  71.             break;
  72.         case "renumberByFrame":
  73.             $value = `getAttr hardwareRenderGlobals.byExtension`;
  74.             break;
  75.         case "width":
  76.             $value = `getAttr hardwareRenderGlobals.resolutionX`;
  77.             break;
  78.         case "height":
  79.             $value = `getAttr hardwareRenderGlobals.resolutionY`;
  80.             break;
  81.         case "deviceAspectRatio":
  82.         // HW does not store de device ratio. But we need to return
  83.         // the value so that other renderer can update it.
  84.             float $ratio = `getAttr hardwareRenderGlobals.pixelAspectRatio`;
  85.             float $valueX = `getAttr hardwareRenderGlobals.resolutionX`;
  86.             float $valueY = `getAttr hardwareRenderGlobals.resolutionY`;
  87.             $value = ($ratio * $valueX) / $valueY;
  88.             break;
  89.         case "pixelAspectRatio":
  90.             $value = `getAttr hardwareRenderGlobals.pixelAspectRatio`;
  91.             break;
  92.         case "enableDefaultLight":
  93.             $value = `getAttr hardwareRenderGlobals.enableDefaultLight`;
  94.             break;
  95.         case "preRenderMel":
  96.             $value = `getAttr hardwareRenderGlobals.preRenderMel`;
  97.             break;
  98.         case "postRenderMel":
  99.             $value = `getAttr hardwareRenderGlobals.postRenderMel`;
  100.             break;
  101.         default:
  102.             warning(
  103.                 "mayaHardwareGetCommonGlobalValue() was asked for the value "
  104.                 + "of a global ("
  105.                 + $global 
  106.                 + ") it does not support. "
  107.                 + "Modify mayaHardwareHasCommonGlobal() to fix the problem\n");
  108.             break;
  109.     }
  110.  
  111.     return $value;
  112. }
  113.